<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});


//小程序登录接口
Route::post('/xcx/getsession', 'UserCenterController@getSessionKey');
Route::post('/xcx/setlogin', 'UserCenterController@setLogin');
Route::post('/xcx/accesstoken', 'UserCenterController@getAccessToken');


Route::any('identifications/auth', 'IdentificationAPIController@auth');
Route::any('identifications/save', 'IdentificationAPIController@saveALl');
Route::resource('identifications', 'IdentificationAPIController');

Route::middleware('xcx.checklogin')->group(function () {
    //小程序图片上传
    Route::post('/xcx/upload', 'PicturesController@upload');
    Route::post('/xcx/get-qiniu-token', 'PicturesController@getQiniuToken');

    //用户信息
    Route::get('userinfo','UsersController@userInfo');
    //发送验证码
    Route::any('sendverifycode','UsersController@sendVerifyCode');
    Route::any('setverifycode','UsersController@setVerifyCode');



    Route::resource('configs', 'ConfigAPIController');
});

Route::any('pipe/post','UtilController@pipePost');

Route::resource('goods', 'GoodsAPIController');